<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
      // document.onkeypress = function (e) {
      //   console.log('keypress');
      //   console.log(e);
      // };
      // 按下触发
      // document.onkeydown = function (e) {
      //   console.log('keydown');
      //   console.log(e);
      // };
      // 弹起来触发
      document.onkeyup = function (e) {
        console.log('keyup');
        console.log(e);
      };
    </script>
  </body>
</html>